package com.luhuiguo.cms.shared.event;

import com.google.gwt.event.shared.GwtEvent;
import com.luhuiguo.cms.shared.model.ChannelModel;
import com.luhuiguo.cms.shared.model.ChannelTreeModel;

public class ChannelUpdatedEvent extends GwtEvent<ChannelUpdatedEventHandler> {

    public static Type<ChannelUpdatedEventHandler> TYPE = new Type<ChannelUpdatedEventHandler>();

    private final ChannelTreeModel channelTreeModel;

    private final ChannelModel channelModel;

    public ChannelUpdatedEvent(ChannelModel channelModel, ChannelTreeModel channelTreeModel) {
        this.channelModel = channelModel;
        this.channelTreeModel = channelTreeModel;
    }

    public ChannelTreeModel getChannelTreeModel() {
        return channelTreeModel;
    }

    public ChannelModel getChannelModel() {
        return channelModel;
    }

    @Override
    public Type<ChannelUpdatedEventHandler> getAssociatedType() {
        return TYPE;
    }

    @Override
    protected void dispatch(ChannelUpdatedEventHandler handler) {
        handler.onChannelUpdated(this);
    }
}
